home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / ROWCOL.C < prev    next >
Text File  |  1986-05-18  |  1KB  |  42 lines

  1. /* 1.0  01-08-86                        (_rowcol.c)
  2.  ************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1986        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10. #include "stdio.h"
  11.  
  12. /*----------------------------------------------------------------------*/
  13.  
  14. /*            EXTERNAL REFERENCES                */
  15.  
  16. GLOBAL int outrow[], outcol[];
  17.  
  18. /************************************************************************/
  19.     VOID
  20. _rowcol(c, fp)        /* update outrow and outcol for character c.    */
  21.  
  22. /*----------------------------------------------------------------------*/
  23. FILE *fp;
  24. {
  25.     switch (c)
  26.     {   case '\n':
  27.         ++outrow[fp->_unit];
  28.         case '\r':
  29.         outcol[fp->_unit] = 0;
  30.         break;
  31.         case '\t':
  32.         while (++outcol[fp->_unit] % TABSTOP)
  33.             ;
  34.         break;
  35.         case '\f':
  36.         outrow[fp->_unit] = 0;
  37.         break;
  38.         default:
  39.         ++outcol[fp->_unit];
  40.     }
  41. }
  42.